﻿<local:PreviewControl x:Class="SuplexApp.FillMapPrvw"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:local="clr-namespace:SuplexApp"
                      xmlns:splxApi="clr-namespace:Suplex.Forms.ObjectModel.Api;assembly=Suplex.Core"
                      >
    <Expander Margin="0,2,0,0"
                  IsExpanded="{local:FormattedBinding RelativeSource={RelativeSource AncestorType={x:Type local:FillMapPrvw}}, Path=IsDetailExpanded, UpdateSourceTrigger=Explicit}">
        <Expander.Header>
            <StackPanel Orientation="Horizontal">
                <Label Content="{local:FormattedBinding Path=ExpressionType, FormatString='ExpressionType: \{0\}'}"/>
                <Label Content="{local:FormattedBinding Path=DataBindings.Count, FormatString=', DataBindings: \{0\}'}"/>
            </StackPanel>
        </Expander.Header>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition MaxWidth="200"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <Label Grid.Column="0" Grid.Row="0" HorizontalContentAlignment="Right" Content="Expression:" Margin="0,0,5,0"/>
            <Label Grid.Column="1" Grid.Row="0" Content="{Binding Path=Expression}" />

            <Label Grid.Column="0" Grid.Row="1" HorizontalContentAlignment="Right" Content="Expression Type:" Margin="0,0,5,0"/>
            <Label Grid.Column="1" Grid.Row="1" Content="{Binding Path=ExpressionType}"/>

            <Label Grid.Column="0" Grid.Row="2" HorizontalContentAlignment="Right" Content="Event Binding:" Margin="0,0,5,0"/>
            <Label Grid.Column="1" Grid.Row="2" Content="{Binding Path=EventBinding}"/>

            <Label Grid.Column="0" Grid.Row="3" HorizontalContentAlignment="Right" Content="Sort Order:" Margin="0,0,5,0"/>
            <Label Grid.Column="1" Grid.Row="3" Content="{Binding Path=SortOrder}"/>

            <Label Grid.Column="0" Grid.Row="4" HorizontalContentAlignment="Right" VerticalAlignment="Top" Content="Data Bindings:" Margin="0,2,5,0"/>
            <ListView Grid.Column="1" Grid.Row="4" BorderThickness="0" Margin="0" MinHeight="200" ItemsSource="{Binding Path=DataBindings}">
                <ListView.View>
                    <GridView AllowsColumnReorder="true">
                        <GridViewColumn DisplayMemberBinding="{Binding Path=ControlName}" Header="Control Name" Width="100"/>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=PropertyName}" Header="Property" Width="100"/>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=DataMember}" Header="Value" Width="100"/>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=OverrideValue}" Header="Override Existing Value" Width="100"/>
                    </GridView>
                </ListView.View>
            </ListView>
        </Grid>
    </Expander>
</local:PreviewControl>
